#include "app.h"
#include "timer_proc.h"
#include "gpio.h"
#include "tim.h"
#include "bsp_hall.h"
#include "bsp_motor.h"
#include "user_table.h"
#include "user_key.h"
#include "user_common.h"
#include "user_memery.h"
#include "user_healthmode.h"
#include "user_procotol.h"
#include "test.h"


void HAL_DelayTick(uint32_t ms);
void user_init(void)
{
		Bsp_User_ADC1_Init();	
		Apl_IO_Init();
		Apl_Com_Init();
		User_Key_Init();
		User_Display_Init();
		User_Table_Init();
		User_Memery_Init();
		HAL_DelayTick(400);
		User_Fault_Init();
		Bsp_V33OUTPUT_SetH();
}



void user_app(void)
{
		Apl_IO_Loop();
		Apl_Com_Loop();
		User_Table_Task();
		User_Memery_Task();
		User_Key_Task();
		if(check_timer1_5ms_flag() == 1)
		{    
				User_Fault_Task();
				set_timer1_5ms_flag(0);
		}		
		if(check_timer1_50ms_flag() == 1)
		{    
				User_Buzzer_Task();
				set_timer1_50ms_flag(0);
		}	
		if(check_timer1_100ms_flag() == 1)
		{    
			#if TestEnadble
				test_app();
			#endif
				User_Display_Task();
				set_timer1_100ms_flag(0);
		}									
}
